local MapBuff = class("MapBuff")

function MapBuff:read(value)
	self.uid = value.uid
	self.tid = value.tid
	self.remainTime = value.remainTime
	self.destroyTime = value.destroyTime

	self._conf = GD:getBuffConfig(self.tid)

	-- print("MapBuff:read ************************ ")
	-- print("MapBuff:read  self.uid = ",self.uid)
	-- print("MapBuff:read  self.tid = ",self.tid)
	-- print("MapBuff:read  self.remainTime = ",self.remainTime)
	-- print("MapBuff:read  self.destroyTime = ",self.destroyTime)
end


function MapBuff:write(value)
	value.uid = self.uid
	value.tid = self.tid
	value.remainTime = self.remainTime
	value.destroyTime = self.destroyTime
end

function MapBuff:ctor()
	self.uid = ""
	self.tid = 0
	self.remainTime = 0
	self.destroyTime = 0
	self.amount = 0
end

function MapBuff:setAmount(amount)
	self.amount = amount
end

function MapBuff:getAmount()
	return self.amount
end

function MapBuff:getIcon()
	if not self._icon then
		self._icon = string.format("%s%s.png", Res.buffIconPath, self._conf.icon)
	end
	return self._icon
end

function MapBuff:getIconBg()
	return Res.Qulity_Icon_Bg[self:getQuality()]
end

function MapBuff:getName()
	return L(self._conf.name)
end

function MapBuff:getTypeName()
	return "buff"
end

function MapBuff:getDesc()
	return L(self._conf.mapbuffdesc)
end

function MapBuff:getQuality()
	return 1
end

return MapBuff